﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MindASPCoreWebAPI.DtoModel.Common;
using MindASPCoreWebAPI.PoModel.SystemManager;
using MindASPCoreWebAPI.Service.SystemManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MindASPCoreWebAPI.ApiProject.Area.SystemManager
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DictionariesController : SystemManagerBaseController
    {
        private DictionariesService _dictionariesService;
        public DictionariesController(DictionariesService dictionariesService)
        {
            _dictionariesService = dictionariesService;
        }
        /// <summary>
        /// 根据字典类别key获取下面的字典选项
        /// </summary>
        /// <param name="typeKey">字典类别key</param>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<Dictionary_Model>> GetDtListByTypeKey(string typeKey)
        {
            try
            {
                var data = _dictionariesService.GetDtListByTypeKey(typeKey);
                return MyOk(data);
            }
            catch (Exception ex)
            {
                return MyError<List<Dictionary_Model>>(ex);
            }
        }
    }
}
